/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package battleship_server.threads;

import battleship_server.Manager;
import battleship_server.SocketConnection;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author omar
 */
public class WaitSockets extends Thread {

    private SocketConnection sc;

    public WaitSockets(SocketConnection sc) {
        this.sc = sc;
    }

    @Override
    public void run() {
        try {
            sc.getOut().println("TimerStart");
            int seg = 0;
            String pp = sc.getIn().readLine();
            if (pp.equalsIgnoreCase("again")) {
                Manager.onlineUsers.add(sc);
                sc.getOut().println("inWaitList");
            } else {
                sc.getOut().println("Goodbye");
                sc.goodbye();
            }
        } catch (IOException ex) {
            Logger.getLogger(WaitSockets.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
